import { METHOD } from '@lingshu/request-lib';
import { langHttp } from '@/utils/RequestUtils';

export const proxyLanguageRequest: any = (params: any) => {
  const requestParams = {
    url: params.url,
    method: params.method,
  };
  if (params.method === METHOD.POST) {
    Object.assign(requestParams, {
      data: params.data,
    });
  } else {
    Object.assign(requestParams, {
      params: params.data,
    });
  }
  return langHttp.request.sendRequest(requestParams).then((res) => {
    return res?.data;
  });
};
